using System.ComponentModel.DataAnnotations;

namespace Model.Dto.Student;

/// <summary>
/// 学生编辑数据传输对象
/// </summary>
/// <remarks>
/// 用于更新学生信息时接收客户端提交的数据，包含数据验证规则
/// </remarks>
public class StudentEdit
{
    /// <summary>
    /// 学号
    /// </summary>
    // [Required(ErrorMessage = "学号不能为空")]
    [StringLength(20, ErrorMessage = "学号长度不能超过20个字符")]
    public string No { get; set; } = string.Empty;

    /// <summary>
    /// 姓名
    /// </summary>
    // [Required(ErrorMessage = "姓名不能为空")]
    [StringLength(50, ErrorMessage = "姓名长度不能超过50个字符")]
    public string Name { get; set; } = string.Empty;

    /// <summary>
    /// 手机号码
    /// </summary>
    // [Required(ErrorMessage = "手机号不能为空")]
    [RegularExpression(@"^1[3-9]\d{9}$", ErrorMessage = "手机号格式不正确")]
    public string Mobile { get; set; } = string.Empty;

    /// <summary>
    /// 年级
    /// </summary>
    // [Required(ErrorMessage = "年级不能为空")]
    [StringLength(20, ErrorMessage = "年级长度不能超过20个字符")]
    public string Grade { get; set; } = string.Empty;

    /// <summary>
    /// 专业
    /// </summary>
    // [Required(ErrorMessage = "专业不能为空")]
    [StringLength(50, ErrorMessage = "专业长度不能超过50个字符")]
    public string Major { get; set; } = string.Empty;

    /// <summary>
    /// 班级
    /// </summary>
    // [Required(ErrorMessage = "班级不能为空")]
    [StringLength(30, ErrorMessage = "班级长度不能超过30个字符")]
    public string Class { get; set; } = string.Empty;

    /// <summary>
    /// 性别
    /// </summary>
    // [Required(ErrorMessage = "性别不能为空")]
    [RegularExpression(@"^(男|女)$", ErrorMessage = "性别只能是男或女")]
    public string Sex { get; set; } = string.Empty;

    /// <summary>
    /// 新密码（可选，如果提供则更新密码）
    /// </summary>
    [StringLength(100, MinimumLength = 6, ErrorMessage = "密码长度必须在6-100个字符之间")]
    public string? NewPassword { get; set; }
}